package ecom.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.*;


/**
 * 
 * @author Alexandra
 * 
 */

@Entity
public class OptionAchetee {

	private long id;
	private Date dateAchat;
	private int dureeDeVie; // nombre de jours de validite d'option
	private Date dateFin; // date de fin de la validite de l'option
		
	private OptionPayante optionPayante;	
	private AnnonceEntity anonce;



	@ManyToOne
	@JoinColumn(name="Anonce_ID")
	public AnnonceEntity getAnonce() {
		return anonce;
	}

	public void setAnonce(AnnonceEntity anonce) {
		this.anonce = anonce;
	}

	@ManyToOne
	@JoinColumn(name = "OptionPayante_ID")
	public OptionPayante getOptionPayante() {
		return optionPayante;
	}

	public void setOptionPayante(OptionPayante optionPayante) {
		this.optionPayante = optionPayante;
	}


	public OptionAchetee(Date dateAchat, int dureeDeVie, Date dateFin,
			OptionPayante optionPayante, AnnonceEntity anonce) {
		super();
		this.dateAchat = dateAchat;
		this.dureeDeVie = dureeDeVie;
		this.dateFin = dateFin;
		this.optionPayante = optionPayante;
		this.anonce = anonce;
	}
	
	
	public OptionAchetee(long id, Date dateAchat, int dureeDeVie, Date dateFin,
			OptionPayante optionPayante) {
		super();
		this.id = id;
		this.dateAchat = dateAchat;
		this.dureeDeVie = dureeDeVie;
		this.dateFin = dateFin;
		this.optionPayante = optionPayante;
	}
	public OptionAchetee(Date dateAchat, int dureeDeVie, Date dateFin, OptionPayante optionPayante) {
		super();	
		this.dateAchat = dateAchat;
		this.dureeDeVie = dureeDeVie;
		this.dateFin = dateFin;		
		this.optionPayante = optionPayante;
	}
	public OptionAchetee(){}
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Date getDateAchat() {
		return dateAchat;
	}

	public void setDateAchat(Date dateAchat) {
		this.dateAchat = dateAchat;
	}

	public int getDureeDeVie() {
		return dureeDeVie;
	}

	public void setDureeDeVie(int dureeDeVie) {
		this.dureeDeVie = dureeDeVie;
	}

	public Date getDateFin() {
		return dateFin;
	}

	public void setDateFin(Date dateFin) {
		this.dateFin = dateFin;
	}

//	public int getIdOptionPayante() {
//		return idOptionPayante;
//	}
//
//	public void setIdOptionPayante(int idOptionPayante) {
//		this.idOptionPayante = idOptionPayante;
//	}

}
